package com.michau.testitas.common.model.property;

import com.michau.testitas.common.model.BaseEntity;
import com.michau.testitas.common.model.testentity.TestEntity;
import com.michau.testitas.common.model.user.User;

import javax.persistence.*;

/**
 * User: michau
 * Date: 1/8/13
 * Time: 7:23 PM
 */
@Entity
@Table(name = "testit_properties", uniqueConstraints = @UniqueConstraint(columnNames = {"testentity_id", "user_id"}))
public class Properties extends BaseEntity{

    @ManyToOne
    @JoinColumn(name = "testentity_id")
    private TestEntity testEntity;

    @ManyToOne
    @JoinColumn(name = "user_id")
    private User owner;

    @Column(name="times_asked", nullable = false)
    private int timesAsked;

    @Column(name="times_answered", nullable = false)
    private int timesAnswered;

    @Column(name="difficulty", nullable = false, precision = 2)
    private double difficulty;

}